<template>
  <div class="marketSearch"
       ref="marketSearch">
    <div>
      <div class="container">
        <rh-input v-model="search"
                  placeholder="请输入搜索内容"></rh-input>
        <rh-button @click="onSubmit">搜索</rh-button>
      </div>
    </div>
  </div>
</template>

<script>
import RhInput from '@/components/basic/rh-input'
import RhButton from '@/components/basic/rh-button'
export default {
  components: {
    RhInput,
    RhButton
  },
  data () {
    return {
      search: ''
    }
  },
  methods: {
    onSubmit () {
      if (this.search) {
        // 跳转到搜索界面
        this.$router.push({ path: '/search', query: { content: this.search } });
      } else {
        alert("请输入搜索内容");
      }
    },
    searchBtn () {
      this.$refs.searchItem.style.outline = "#f50";
    }
  }
}
</script>

<style lang="less" scoped>
.marketSearch {
  width: 100%;
  height: 150px;
  box-sizing: border-box;
  background-color: #fff;
  padding: 60px 0 50px 0;

  .container {
    box-sizing: border-box;
    width: 720px;
    height: 40px;
    padding-left: 80px;
    margin: 0 auto;

    .rh-input {
      width: 500px;
      display: inline-block;
    }
  }
  .isFixed {
    z-index: 99;
    position: fixed;
    top: 0;
    width: 100%;
    background-color: #fff;
    padding: 10px 0 10px 0;
  }
}
</style>